package com.sl.biz.modular.process.controller;

import com.sl.biz.modular.process.controller.request.ProcessCompVersionRebuildRequest;
import com.sl.biz.modular.process.controller.request.ProcessCompVersionSaveRequest;
import com.sl.biz.modular.process.dao.domain.dto.ProcessCompVersionDTO;
import com.sl.biz.modular.process.dao.domain.entity.ProcessCompDO;
import com.sl.biz.modular.process.dao.domain.entity.ProcessCompObjectDO;
import com.sl.biz.modular.process.dao.domain.entity.ProcessCompVersionDO;
import com.sl.biz.modular.process.service.ProcessCompVersionBizService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/process/comp/version")
@RequiredArgsConstructor
public class ProcessCompVersionController {

    private final ProcessCompVersionBizService compVersionBizService;


    @PostMapping("/list")
    public List<ProcessCompVersionDTO> list(@RequestBody ProcessCompVersionDO processCompVersionDO) {
        return compVersionBizService.list(processCompVersionDO);
    }


    //isInitDemoFlag

    @PostMapping("/save")
    public Boolean save(@RequestBody ProcessCompVersionSaveRequest processComp) {
        return compVersionBizService.save(processComp);
    }


    @PostMapping("/set_status_flag")
    public Boolean setStatusFlag(@RequestBody @Validated ProcessCompVersionDO assertUserUse) {
        return compVersionBizService.setStatusFlag(assertUserUse);
    }

    @PostMapping("/remove_by_id")
    public Boolean removeById(@RequestBody @Validated ProcessCompVersionDO assertUserUse) {
        return compVersionBizService.removeById(assertUserUse);
    }


    @PostMapping("/get_by_id")
    public ProcessCompVersionDTO getById(@RequestBody @Validated ProcessCompVersionDO addRequest) {
        return compVersionBizService.getById(addRequest);
    }


    @PostMapping("/rebuild")
    public Boolean rebuild(@RequestBody ProcessCompVersionRebuildRequest processComp) {
        return compVersionBizService.rebuild(processComp);
    }
}
